import json
from flask import Blueprint, request, jsonify

from database import db

reg_bp = Blueprint('reg', __name__)


@reg_bp.route('/reg/', methods=['POST', 'GET'])
def Reg():
    if request.method == "POST":
        data = json.loads(request.data)
        mobile = data['mobile']
        password = data['password']
        sql = "insert into goods(mobile,password) values (%s,%s)" % (mobile, password)
        db.insert(sql)
        return jsonify({'code': 200})
    else:
        return '获取'
